package com.shuker.design.factory.good;

import com.shuker.design.factory.good.impl.CardCommodityService;
import com.shuker.design.factory.good.impl.CouponCommodityService;
import com.shuker.design.factory.good.impl.GoodsCommodityService;
import com.shuker.design.factory.good.store.ICommodity;

/**
 * @author ：Shuker
 * @date ：Created in 2022/1/10 18:54
 * @description：创建商品工厂
 * @version: 1.0
 */
public class StoreFactory {
    public ICommodity getCommodityService(Integer commodityType){
        switch (commodityType){
            case 1:
                return new CouponCommodityService();
            case 2:
                return new GoodsCommodityService();
            case 3:
                return new CardCommodityService();
        }
        throw new RuntimeException("不存在的商品服务类型");
    }
}
